#三红vs四进

import random
import random

class BoBingGame:
    def __init__(self):
        pass

    def roll_dice(self):
        return [random.randint(1, 6) for _ in range(6)]

    def is_three_red(self, dice):
        return dice.count(4) == 3

    def is_four_same(self, dice):
        return len(set(dice)) == 3 and dice.count(4) != 4

    def simulate_game(self, num_trials):
        num_three_red = 0
        num_four_same = 0

        for _ in range(num_trials):
            dice = self.roll_dice()
            if self.is_three_red(dice):
                num_three_red += 1
            if self.is_four_same(dice):
                num_four_same += 1

        prob_three_red = num_three_red / num_trials
        prob_four_same = num_four_same / num_trials

        return prob_three_red, prob_four_same

if __name__ == '__main__':
    num_trials = 1000000  # 模拟的次数，可以根据需要调整
    game = BoBingGame()
    prob_three_red, prob_four_same = game.simulate_game(num_trials)

    print("三红出现的概率: {:.4f}".format(prob_three_red))
    print("四进出现的概率: {:.4f}".format(prob_four_same))

